﻿namespace com.vs.DataAccess
{
    using com.vs.General;
    using System;
    using System.Data;

    public class CDBChange : IDisposable
    {
        private Session _session = null;

        public CDBChange(Session session)
        {
            if (session == null)
            {
                throw new Exception("No session.");
            }
            this._session = session;
        }

        public void Dispose()
        {
        }

        public int executeSQLChange(string sql)
        {
            DataHelper helper = null;
            using (helper = new DataHelper(this._session))
            {
                return helper.Update(CommandType.Text, sql, new IDataParameter[0]);
            }
        }

        public int executeSQLInsert(string sql, string key)
        {
            DataHelper helper = null;
            using (helper = new DataHelper(this._session))
            {
                return helper.Insert(CommandType.Text, sql, key, new IDataParameter[0]);
            }
        }
    }
}

